import { parseUrl } from '@/utils/shared'
// 获取当前页面 name 路径 参数
export function useInit() {
  onShow(() => {
    console.log('Page Show')
  })
  onHide(() => {
    console.log('Page Hide')
  })
  const pages = getCurrentPages()
  const page = pages[pages.length - 1]
  // @ts-expect-error
  const { fullPath } = page.$page
  const {
    name: pageName,
    path: pagePath,
    query: pageQuery
  } = parseUrl(fullPath)

  return {
    pageName,
    pagePath,
    pageQuery
  }
}
